<template>
    <div class="container">
        <div class="login-modal">
            <div class="login-modal__title">
                账号注册
            </div>

            <div class="login-form" :style="'margin-top: 29px'">
                <el-input type="text" size="large" v-model="phone" placeholder="请输入你的手机号">
                    <template #prepend>
                        <el-select v-model="num" size="large" style="width: 80px">
                            <el-option label="+86" :value="86" />
                        </el-select>
                    </template>
                </el-input>

                <el-input type="text" size="large" v-model="code" placeholder="请输入验证码" :style="`margin-top: 10px`">
                    <template #append>
                        <el-button @click="onSendCode">{{
                            codeText
                        }}</el-button>
                    </template>
                </el-input>

                <el-input type="password" size="large" v-model="password" placeholder="请输入密码" :style="`margin-top: 10px`"
                    show-password>
                </el-input>

                <el-date-picker v-model="birthday" type="date" size="large" class="no-icon" :prefix-icon="false"
                    :clearable="false" placeholder="请选择出生日期" :style="`margin-top: 10px`" :disabledDate="birthdayDisabled"
                    value-format="YYYY-MM-DD"></el-date-picker>
            </div>

            <div class="login-btn" @click="onSubmit" :style="{ marginTop: '15px' }">
                注册
            </div>

            <div class="login-footer" :style="{ marginTop: '10px' }">
                <div class="login-btn-group">
                    <span @click="onLogin">密码登录</span>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
import { useContent } from ".";

const {
    num,
    phone,
    birthday,
    password,
    codeText,
    code,
    birthdayDisabled,
    onSendCode,
    onLogin,
    onSubmit,
} = useContent();
</script>
<style lang="scss" scoped>
.container {
    position: relative;
    width: 100%;
    height: calc(100vh - 70px);
    background-image: url("https://yzpt-resources.oss-cn-hangzhou.aliyuncs.com/web/images/login/bg.jpg");
    background-size: cover;
}

.login-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 350px;
    height: 400px;
    padding: 0 24px 0 26px;
    background: #ffffff;
    border-radius: 10px;
    transform: translate(-50%, -50%);
    box-sizing: border-box;

    &__title {
        text-align: center;
        margin-top: 39px;
        font-size: 30px;
    }

    .login-form {
        position: relative;
        margin-top: 39px;

        .form-footer {
            width: 100%;
            position: absolute;
            left: 0;
            bottom: -30px;
            display: flex;
            align-items: center;
            justify-content: space-between;

            .forgot-pwd {
                color: #5185fb;
                font-size: 12px;
                cursor: pointer;
                user-select: none;
            }
        }
    }

    .login-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 40px;
        font-size: 18px;
        color: #fff;
        background-color: #5185fb;
        border-radius: 6px;
        cursor: pointer;
        user-select: none;
    }

    .login-footer {
        display: flex;
        justify-content: center;
        margin-top: 30px;
        color: #666;
        font-size: 14px;

        .btn-group {
            display: flex;
            align-items: center;
            cursor: pointer;
            user-select: none;

            &:first-of-type {
                margin-right: 40px;
            }

            img {
                margin-right: 6px;
                color: #666;
                font-size: 14px;
            }
        }
    }
}

.login-btn-group {
    text-align: center;
    color: #5185fb;
    cursor: pointer;
    user-select: none;
}

:deep(.no-icon) {
    width: 100%;

    .el-input__prefix {
        display: none !important;
    }
}
</style>
